package com.bbs.service.impl;

import com.bbs.dao.CommentDao;
import com.bbs.entity.Comment;
import com.bbs.entity.User;
import com.bbs.service.CommentService;
import com.bbs.utils.MyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component("commentService")
public class CommentImpl implements CommentService {
    @Autowired
    private CommentDao commentDao;

    //楼中楼插入数据
    @Override
    public int insertComment(int rid,String content,int uid) {
        Comment comment=new Comment();
        comment.setRid(rid);
        comment.setUid(uid);
        comment.setContent(content);
        comment.setCommentTime(MyUtil.formatDate(new Date()));
        commentDao.insertComment(comment);
        return 0;
    }
}
